<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	$kboy_userid = $_SESSION['kboy_userid'];
	$kboy_user = $_SESSION['kboy_user'];
	
	$uid = chkstr(trim($_REQUEST['uid']));
	$ac = chkstr(trim($_REQUEST['ac']));
	if(empty($uid)){
		echo erro("参数错误");
	}
	if(!is_numeric($uid)){
		echo erro("参数错误");
	}
	if(getNewsNums("kboy_user","uid=$uid") <1){
		echo erro("参数错误");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的足迹_社区_<?= $web_titles ?></title>
<meta name="Keywords" content="我的足迹,社区,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/sq.css" />
<script type="text/javascript" src="js/baidutongji.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--header end-->
    <!--banner begin-->
	<? include("_include.forum.banners.php") ?>
    <!--banner end-->
    <!--活动 begin-->
    <div class="sq-wrap">
		<? include("_include.forum.title.php") ?>
        <div class="sq-bd">
			<? include("_include.forum.topnav.php") ?>
            <div class="sq-bd-con">
                <div class="ActivityTop">
                    <span class="title"><?php if($_SESSION['kboy_userid'] == $uid) {?>我<?php }else{ ?>ta<?php } ?>的足迹</span>
                </div>
                <div id="footMap" class="map" style="height:500px;">
                    
                </div>
                <div class="footstepsBOX">
                    <div class="footstepsMain">
                        <div id="usertracks">
						<?php
								$news_sql = "select * from kboy_forum_map where uid=$uid group by map_year desc";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
						?>
                            <div class="YearLine"><span><?=$news_rs['map_year']?></span><em><a></a></em></div>
						<?php
								$news_sql2 = "select * from kboy_forum_map where uid=$uid and map_year='".$news_rs['map_year']."' order by id desc";
								$news_rows2 = mysql_query($news_sql2);
								while($news_rs2 = mysql_fetch_array($news_rows2)){
						?>	
                            <div class="footDIV">
                                <div class="r">
                                    <span class="circle"></span>
                                    <span class="Riangle"></span>
                                    <div class="r_middle">
                                        <div class="r_right">
                                            <dl class="r_right_list">
                                                <dt class="Time_Site Anti autocut"><span><?=$news_rs2['map_year']?>-<?=$news_rs2['map_month']?></span><em><a href="javascript:void(0);"><?=$news_rs2['map_prov']?></a></em></dt>
                                                <dt class="Comment"><span><?=$news_rs2['map_text']?></span></dt>
                                                
                                            </dl>
                                        </div>
                                    </div>
                                </div>
                            </div>
						<?php
								}
								}
						?>



                        </div>
                        <!--点击第一次添加-->
                        <div class="LastYearLine">
                            <span></span>
                            <em>
                                <b></b>
                                <div class="LastLine">
                                    <span class="Riangle"></span>
                                    <div class="r_middle">
                                        <div class="r_right"><a id="addnewlink" href="alert.forummap.php?rnd=<?=rand(10,100)?>" title="添加一个旅行足迹">
                                            <div class="rr_right">点击此处记录<?php if($_SESSION['kboy_userid'] == $uid) {?>我<?php }else{ ?>ta<?php } ?>的足迹</div>
                                        </a></div>
                                    </div>
                                </div>
                            </em>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
    <!--左侧悬浮 end-->
    <!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
    <!--右侧悬浮导航 end-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="js/alert.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=zQQIlBBVh4I9MpRsPipvhYA2"></script>
    <script type="text/javascript">
    $.get('json.getmap.php?uid=<?=$uid?>', function(data) {
        initmap(data);
    });
		// 百度地图API功能	
   
    function initmap(data){
	data = $.parseJSON(data);
        // 百度地图API功能    
        map = new BMap.Map("footMap");
        map.centerAndZoom("西安",5);
		map.enableScrollWheelZoom();
 
        var data_info =data.data;
        var myGeo = new BMap.Geocoder();
        var index=0;
 
        var opts = {
            width: 250, // 信息窗口宽度
            height: 80, // 信息窗口高度
            title: data.username, // 信息窗口标题
            enableMessage: true //设置允许信息窗发送短息
        };
        setgeo();
        function setgeo(){
            var one = data_info[index];
                geocodeSearch(one);
                index++;
        }
		//增加折线
		/*var coordinates = new Array();
		for(var i=0;i<data_info.length;i++){
		 coordinates[i] = new BMap.Point(data_info[i].lng,data_info[i].lat);
		}
	    var polyline = new BMap.Polyline(coordinates, {strokeColor:"red", strokeWeight:2, strokeOpacity:0.5});   //创建折线
	    map.addOverlay(polyline);*/ 
	 
	
        function geocodeSearch(one){
            if(index < data_info.length){
                setTimeout(setgeo,400);
            } 
            console.log(one);
            myGeo.getPoint(one.city,function(point){
                var marker = new BMap.Marker(point); // 创建标注
                map.addOverlay(marker); // 将标注添加到地图中
                addClickHandler(one.msg, marker);
 
            });
        }
        function addClickHandler(content, marker) {
            marker.addEventListener("click", function(e) {
                openInfo(content, e)
            });
        }
            function openInfo(content, e) {
            var p = e.target;
            var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
            var infoWindow = new BMap.InfoWindow(content, opts); // 创建信息窗口对象 
            map.openInfoWindow(infoWindow, point); //开启信息窗口
        }
    }
    </script>
</body>
 
</html>

